xref: /haiku/docs/apps/mail/Public API/MailMessage.html (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1<HTML>
2<HEAD>
3   <TITLE>MailMessage</TITLE>
4</HEAD>
5<BODY BGCOLOR="#FFFFFF" LINK="#2222AA" BACKGROUND="../art/bodyBack.gif">
6<P><A NAME=BCursor></A> <!--TOP LINKS--></P>
7
8<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
9   <TR>
10      <TD>
11         <P><TABLE BGCOLOR="#550033" CELLPADDING=5>
12            <TR>
13               <TD>
14                  <P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
15                  Kit 2 Root</B></FONT></A></P>
16               </TD>
17               <TD>
18                  <P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
19                  Public API</B></FONT></A></P>
20               </TD>
21            </TR>
22         </TABLE>
23         </P>
24      </TD>
25   </TR>
26</TABLE>
27
28<HR NOSHADE>
29
30</CENTER>
31
32<P><!--TOP LINKS--></P>
33
34<H1><FONT SIZE="+4">MailMessage</FONT></H1>
35
36<BLOCKQUOTE><FONT FACE="helvetica"><B>Derived
37   from:</B></FONT>&nbsp;<A HREF="MailComponent.html">MailComponent</A><BR>
38   <FONT FACE="helvetica"><B>Declared in:</B></FONT>&nbsp;
39   include/public/MailMessage.h<BR>
40   <FONT FACE="helvetica"><B>Library:</B></FONT>&nbsp;libmail.so<BR>
41
42   <P><BR>
43   </P>
44
45   <P>MailMessage is what you use if you are interested in actually
46   sending messages. It allows you to add an arbitrary number of
47   components (naturally making it multipart only if there is more
48   than one), and provides many convenience functions for adding, modifying
49   and accessing both headers and data. If you use this kit, you will get to
50   know MailMessage very well.</P></BLOCKQUOTE>
51
52<P>
53
54<HR NOSHADE>
55
56</P>
57
58<H2><FONT SIZE="+3" COLOR="#430000">C</FONT><FONT COLOR="#430000">onstructor
59and
60</FONT><FONT SIZE="+3" COLOR="#430000">D</FONT><FONT COLOR="#430000">estructor</FONT></H2>
61
62<P>
63
64<HR>
65
66<A NAME=MailMessage></A><TABLE>
67   <TR>
68      <TD>
69         <P></P>
70      </TD>
71      <TD>
72         <P><FONT SIZE="+2">MailMessage() </FONT></P>
73      </TD>
74   </TR>
75</TABLE>
76</P>
77
78<P>&nbsp;</P>
79
80<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
81      <TR>
82         <TD>
83            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
84               <TR>
85                  <TD>
86                     <P><FONT SIZE="+1"><B><TT>MailMessage(</TT></B></FONT>
87                     BPositionIO *<FONT FACE="HELVETICA" COLOR="#991122"><I>mail_file</I></FONT> = <B>NULL</B>
88                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
89                  </TD>
90               </TR>
91            </TABLE>
92            </P>
93         </TD>
94      </TR>
95   </TABLE>
96
97   <P>Creates a new MailMessage. If <FONT FACE="HELVETICA" COLOR="#991122"><I>mail_file</I></FONT> is not <B>NULL</B>,
98   the MailMessage will be instantiated to the RFC 822 format data contained
99   in <FONT FACE="HELVETICA" COLOR="#991122"><I>mail_file</I></FONT>.</P>
100
101   <P>&nbsp;</P></BLOCKQUOTE>
102
103<P>
104
105<HR>
106
107<A NAME="~MailMessage"></A><TABLE>
108   <TR>
109      <TD>
110         <P></P>
111      </TD>
112      <TD>
113         <P><FONT SIZE="+2">~MailMessage() </FONT></P>
114      </TD>
115   </TR>
116</TABLE>
117</P>
118
119<P>&nbsp;</P>
120
121<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
122      <TR>
123         <TD>
124            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
125               <TR>
126                  <TD>
127                     <P>virtual
128                     <FONT SIZE="+1"><B><TT>~MailMessage()</TT></B></FONT></P>
129                  </TD>
130               </TR>
131            </TABLE>
132            </P>
133         </TD>
134      </TR>
135   </TABLE>
136
137   <P>Destroys the message, frees internal buffers, and deletes all added
138   components.</P></BLOCKQUOTE>
139
140<P>
141
142<HR NOSHADE>
143
144</P>
145
146<H2><FONT SIZE="+3" COLOR="#430000">M</FONT><FONT COLOR="#430000">ember
147</FONT><FONT SIZE="+3" COLOR="#430000">F</FONT><FONT COLOR="#430000">unctions</FONT></H2>
148
149<P>
150
151<HR>
152
153<A NAME=To></A>
154<A NAME=From></A>
155<A NAME=ReplyTo></A>
156<A NAME=CC></A>
157<A NAME=Subject></A>
158<A NAME=Priority></A>
159<TABLE>
160   <TR>
161      <TD>
162         <P></P>
163      </TD>
164      <TD>
165         <P><FONT SIZE="+2">To (), From (), ReplyTo (), CC (), Subject (), Priority ()</FONT></P>
166      </TD>
167   </TR>
168</TABLE>
169</P>
170
171<P>&nbsp;</P>
172
173<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
174      <TR>
175         <TD>
176            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
177               <TR>
178                  <TD>
179                     <P>const char *
180                     <FONT SIZE="+1"><B><TT>To()</TT></B></FONT></P>
181                  </TD>
182               </TR>
183               <TR>
184                  <TD>
185                     <P>const char *
186                     <FONT SIZE="+1"><B><TT>From()</TT></B></FONT></P>
187                  </TD>
188               </TR>
189               <TR>
190                  <TD>
191                     <P>const char *
192                     <FONT SIZE="+1"><B><TT>ReplyTo()</TT></B></FONT></P>
193                  </TD>
194               </TR>
195               <TR>
196                  <TD>
197                     <P>const char *
198                     <FONT SIZE="+1"><B><TT>CC()</TT></B></FONT></P>
199                  </TD>
200               </TR>
201               <TR>
202                  <TD>
203                     <P>const char *
204                     <FONT SIZE="+1"><B><TT>Subject()</TT></B></FONT></P>
205                  </TD>
206               </TR>
207               <TR>
208                  <TD>
209                     <P>int
210                     <FONT SIZE="+1"><B><TT>Priority()</TT></B></FONT></P>
211                  </TD>
212               </TR>
213            </TABLE>
214            </P>
215         </TD>
216      </TR>
217   </TABLE>
218
219   <P>Returns the relevant header field from the message. These are simply a convenience. <CODE>Subject()</CODE>,
220   for instance, is equivalent to, and implemented as, <CODE>HeaderField(&quot;Subject&quot;)</CODE>. There is
221   no <CODE>BCC()</CODE> function because, for obvious reasons, it is impossible to retrieve BCCs from the message.</P>
222
223   </BLOCKQUOTE>
224
225<P>
226
227<HR>
228
229<A NAME=SetTo></A>
230<A NAME=SetFrom></A>
231<A NAME=SetReplyTo></A>
232<A NAME=SetCC></A>
233<A NAME=SetSubject></A>
234<A NAME=SetPriority></A>
235<TABLE>
236   <TR>
237      <TD>
238         <P></P>
239      </TD>
240      <TD>
241         <P><FONT SIZE="+2">SetTo (), SetFrom (), SetReplyTo (), SetCC (), SetBCC (), SetSubject (), SetPriority ()</FONT></P>
242      </TD>
243   </TR>
244</TABLE>
245</P>
246
247<P>&nbsp;</P>
248
249<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
250      <TR>
251         <TD>
252            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
253               <TR>
254                  <TD>
255                     <P>void
256                     <FONT SIZE="+1"><B><TT>SetTo(</TT></B></FONT>
257                     	const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
258                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
259                  </TD>
260               </TR>
261               <TR>
262                  <TD>
263                     <P>void
264                     <FONT SIZE="+1"><B><TT>SetFrom(</TT></B></FONT>
265                     	const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
266                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
267                  </TD>
268               </TR>
269               <TR>
270                  <TD>
271                     <P>void
272                     <FONT SIZE="+1"><B><TT>SetReplyTo(</TT></B></FONT>
273                     	const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
274                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
275                  </TD>
276               </TR>
277               <TR>
278                  <TD>
279                     <P>void
280                     <FONT SIZE="+1"><B><TT>SetCC(</TT></B></FONT>
281                     	const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
282                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
283                  </TD>
284               </TR>
285               <TR>
286                  <TD>
287                     <P>void
288                     <FONT SIZE="+1"><B><TT>SetBCC(</TT></B></FONT>
289                     	const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
290                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
291                  </TD>
292               </TR>
293               <TR>
294                  <TD>
295                     <P>void
296                     <FONT SIZE="+1"><B><TT>SetSubject(</TT></B></FONT>
297                     	const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
298                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
299                  </TD>
300               </TR>
301               <TR>
302                  <TD>
303                     <P>void
304                     <FONT SIZE="+1"><B><TT>SetPriority(</TT></B></FONT>
305                     	int <FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
306                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
307                  </TD>
308               </TR>
309            </TABLE>
310            </P>
311         </TD>
312      </TR>
313   </TABLE>
314
315   <P>Returns the relevant header field of the message. With the exception of
316   <TT>SetBCC()</TT>, these are simply conveniences which can be easily emulated
317   with <A HREF="MailComponent.html#SetHeaderField">SetHeaderField()</A>.</P>
318
319   </BLOCKQUOTE>
320
321<P>
322
323<HR>
324
325<A NAME=SendViaAccount></A><TABLE>
326   <TR>
327      <TD>
328         <P></P>
329      </TD>
330      <TD>
331         <P><FONT SIZE="+2">SendViaAccount () </FONT></P>
332      </TD>
333   </TR>
334</TABLE>
335</P>
336
337<P>&nbsp;</P>
338
339<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
340      <TR>
341         <TD>
342            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
343               <TR>
344                  <TD>
345                     <P>void
346                     <FONT SIZE="+1"><B><TT>SendViaAccount(</TT></B></FONT>
347                    	 const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>account_name</I></FONT>
348                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
349                  </TD>
350               </TR>
351               <TR>
352                  <TD>
353                     <P>void
354                     <FONT SIZE="+1"><B><TT>SendViaAccount(</TT></B></FONT>
355                    	 int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>chain_id</I></FONT>
356                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
357                  </TD>
358               </TR>
359            </TABLE>
360            </P>
361         </TD>
362      </TR>
363   </TABLE>
364
365   <P>Sets the message up so that it is sent via the account specified by either <FONT FACE="HELVETICA" COLOR="#991122"><I>account_name</I></FONT>
366   or <FONT FACE="HELVETICA" COLOR="#991122"><I>chain_id</I></FONT>, which of course must exist as an outbound chain (see
367   <A HREF="MailChain.html#ChainDirection">MailChain::ChainDirection()</A> for details). Automatically calls <A HREF="#SetFrom">SetFrom()</A> with
368   the return address indicated in the specified chain using the format "Real Name" &lt;e-mail&gt;.</P>
369
370   </BLOCKQUOTE>
371<P>
372
373<HR>
374
375<A NAME=AddComponent></A><TABLE>
376   <TR>
377      <TD>
378         <P></P>
379      </TD>
380      <TD>
381         <P><FONT SIZE="+2">AddComponent() </FONT></P>
382      </TD>
383   </TR>
384</TABLE>
385</P>
386
387<P>&nbsp;</P>
388
389<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
390      <TR>
391         <TD>
392            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
393               <TR>
394                  <TD>
395                     <P>
396                     void <FONT SIZE="+1"><B><TT>AddComponent(</TT></B></FONT>
397                    <A HREF="MailComponent.html">MailComponent</A> *<FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>
398                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
399                  </TD>
400               </TR>
401            </TABLE>
402            </P>
403         </TD>
404      </TR>
405   </TABLE>
406
407   <P>Adds <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT> to this MailMessage. Note that the MailMessage
408   assumes ownership of <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>. Thus, you <B>may not</B> delete <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>.
409   If you continue to modify to it after calling <TT>AddComponent()</TT>, your changes will be reflected when you
410   call <A HREF="#Render">Render()</A>. <TT>AddComponent()</TT> automatically makes the message multipart if there is
411   more than one component.</P></BLOCKQUOTE>
412
413<P>
414
415<HR>
416
417<A NAME=GetComponent></A><TABLE>
418   <TR>
419      <TD>
420         <P></P>
421      </TD>
422      <TD>
423         <P><FONT SIZE="+2">GetComponent() </FONT></P>
424      </TD>
425   </TR>
426</TABLE>
427</P>
428
429<P>&nbsp;</P>
430
431<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
432      <TR>
433         <TD>
434            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
435               <TR>
436                  <TD>
437                     <P>
438                     <A HREF="MailComponent.html">MailComponent</A> * <FONT SIZE="+1"><B><TT>GetComponent(</TT></B></FONT>
439                     int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>
440                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
441                  </TD>
442               </TR>
443            </TABLE>
444            </P>
445         </TD>
446      </TR>
447   </TABLE>
448
449   <P>Returns the component at <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>.
450   Instantiate()s it if it has not yet been instantiated. Otherwise, returns already instantiated
451   component. Use RTTI or <A HREF="MailComponent.html">MailComponent</A> hooks to do useful things with the returned
452   component.</P>
453
454   <P>&nbsp;</P>
455
456   <P></BLOCKQUOTE>
457
458<HR>
459
460<A NAME=CountComponents></A><TABLE>
461   <TR>
462      <TD>
463         <P></P>
464      </TD>
465      <TD>
466         <P><FONT SIZE="+2">CountComponents() </FONT></P>
467      </TD>
468   </TR>
469</TABLE>
470</P>
471
472<P>&nbsp;</P>
473
474<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
475      <TR>
476         <TD>
477            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
478               <TR>
479                  <TD>
480                     <P>
481                     int32 <FONT SIZE="+1"><B><TT>CountComponents()</TT></B></FONT> const</P>
482                  </TD>
483               </TR>
484            </TABLE>
485            </P>
486         </TD>
487      </TR>
488   </TABLE>
489
490   <P>Returns the total number of components in this MailMessage.</P>
491
492   <P>&nbsp;</P></BLOCKQUOTE>
493
494   <P>
495
496<HR>
497
498<A NAME=Attach></A><TABLE>
499   <TR>
500      <TD>
501         <P></P>
502      </TD>
503      <TD>
504         <P><FONT SIZE="+2">Attach () </FONT></P>
505      </TD>
506   </TR>
507</TABLE>
508</P>
509
510<P>&nbsp;</P>
511
512<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
513      <TR>
514         <TD>
515            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
516               <TR>
517                  <TD>
518                     <P>void
519                     <FONT SIZE="+1"><B><TT>Attach(</TT></B></FONT>
520                     	entry_ref *<FONT FACE="HELVETICA" COLOR="#991122"><I>ref</I></FONT>,
521                     	bool <FONT FACE="HELVETICA" COLOR="#991122"><I>include_attributes</I></FONT> = <B>true</B>
522                     <FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
523                  </TD>
524               </TR>
525            </TABLE>
526            </P>
527         </TD>
528      </TR>
529   </TABLE>
530
531   <P>Attaches <FONT FACE="HELVETICA" COLOR="#991122"><I>ref</I></FONT> to this message. If <FONT FACE="HELVETICA" COLOR="#991122"><I>include_attributes</I></FONT>
532   is <B>true</B>, uses an <A HREF="AttributedMailAttachment.html">AttributedMailAttachment</A>
533   instead of a <A HREF="SimpleMailAttachment.html">SimpleMailAttachment</A>. Be aware that is
534   attached in the state it is in when the message is rendered, not when <TT>Attach()</TT> is
535   called.</P></BLOCKQUOTE>
536
537<P>
538
539<HR>
540
541<A NAME=IsComponentAttachment></A><TABLE>
542   <TR>
543      <TD>
544         <P></P>
545      </TD>
546      <TD>
547         <P><FONT SIZE="+2">IsComponentAttachment () </FONT></P>
548      </TD>
549   </TR>
550</TABLE>
551</P>
552
553<P>&nbsp;</P>
554
555<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
556      <TR>
557         <TD>
558            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
559               <TR>
560                  <TD>
561                     <P>bool
562                     <FONT SIZE="+1"><B><TT>IsComponentAttachment(</TT></B></FONT>
563                     int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
564                  </TD>
565               </TR>
566            </TABLE>
567            </P>
568         </TD>
569      </TR>
570   </TABLE>
571
572   <P>If the component at <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT> is an attachment of any
573   kind, returns <B>true</B>, otherwise returns <B>false</B>.</P></BLOCKQUOTE>
574
575<P>
576
577
578<HR>
579
580<A NAME=SetBodyTextTo></A><TABLE>
581   <TR>
582      <TD>
583         <P></P>
584      </TD>
585      <TD>
586         <P><FONT SIZE="+2">SetBodyTextTo () </FONT></P>
587      </TD>
588   </TR>
589</TABLE>
590</P>
591
592<P>&nbsp;</P>
593
594<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
595      <TR>
596         <TD>
597            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
598               <TR>
599                  <TD>
600                     <P>void
601                     <FONT SIZE="+1"><B><TT>SetBodyTextTo(</TT></B></FONT>const
602                     char *<FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
603                  </TD>
604               </TR>
605            </TABLE>
606            </P>
607         </TD>
608      </TR>
609   </TABLE>
610
611   <P>Sets the body of this message to the UTF8 string
612   contained in <FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>.
613   If no body has been specified through <A HREF="#SetBody">SetBody()</A>,
614   <TT>SetBodyTextTo()</TT> creates one.</P></BLOCKQUOTE>
615
616<P>
617
618<HR>
619
620<A NAME=BodyText></A><TABLE>
621   <TR>
622      <TD>
623         <P></P>
624      </TD>
625      <TD>
626         <P><FONT SIZE="+2">BodyText () </FONT></P>
627      </TD>
628   </TR>
629</TABLE>
630</P>
631
632<P>&nbsp;</P>
633
634<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
635      <TR>
636         <TD>
637            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
638               <TR>
639                  <TD>
640                     <P>const char *
641                     <FONT SIZE="+1"><B><TT>BodyText()</TT></B></FONT></P>
642                  </TD>
643               </TR>
644            </TABLE>
645            </P>
646         </TD>
647      </TR>
648   </TABLE>
649
650   <P>Returns the contents of <A HREF="#Body">Body()</A> as a UTF8
651      string. Returns <B>NULL</B> if no body exists.</P></BLOCKQUOTE>
652
653<P>
654<HR>
655
656<A NAME=SetBody></A><TABLE>
657   <TR>
658      <TD>
659         <P></P>
660      </TD>
661      <TD>
662         <P><FONT SIZE="+2">SetBody () </FONT></P>
663      </TD>
664   </TR>
665</TABLE>
666</P>
667
668<P>&nbsp;</P>
669
670<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
671      <TR>
672         <TD>
673            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
674               <TR>
675                  <TD>
676                     <P>status_t
677                     <FONT SIZE="+1"><B><TT>SetBody(</TT></B></FONT>
678                     <A HREF="PlainTextBodyComponent.html">PlainTextBodyComponent</A> *<FONT FACE="HELVETICA" COLOR="#991122"><I>body</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
679                  </TD>
680               </TR>
681            </TABLE>
682            </P>
683         </TD>
684      </TR>
685   </TABLE>
686
687   <P>Sets the body of this message to <FONT FACE="HELVETICA" COLOR="#991122"><I>body</I></FONT>.
688   If a body has already been specified, <TT>SetBody()</TT> returns <B>B_ERROR</B>, otherwise
689   returns <B>B_OK</B>.</P></BLOCKQUOTE>
690
691<P>
692
693<HR>
694
695<A NAME=Body></A><TABLE>
696   <TR>
697      <TD>
698         <P></P>
699      </TD>
700      <TD>
701         <P><FONT SIZE="+2">Body () </FONT></P>
702      </TD>
703   </TR>
704</TABLE>
705</P>
706
707<P>&nbsp;</P>
708
709<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
710      <TR>
711         <TD>
712            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
713               <TR>
714                  <TD>
715                     <P><A HREF="PlainTextBodyComponent.html">PlainTextBodyComponent</A> *
716                     <FONT SIZE="+1"><B><TT>Body()</TT></B></FONT></P>
717                  </TD>
718               </TR>
719            </TABLE>
720            </P>
721         </TD>
722      </TR>
723   </TABLE>
724
725   <P>Returns the body as a <A HREF="PlainTextBodyComponent.html">PlainTextBodyComponent</A> pointer.
726   Returns <B>NULL</B> if no body exists. This object belongs to the MailMessage, do <I>not</I> delete it.</P></BLOCKQUOTE>
727
728<P>
729<HR>
730
731<A NAME=Instantiate></A><TABLE>
732   <TR>
733      <TD>
734         <P></P>
735      </TD>
736      <TD>
737         <P><FONT SIZE="+2">Instantiate () </FONT></P>
738      </TD>
739   </TR>
740</TABLE>
741</P>
742
743<P>&nbsp;</P>
744
745<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
746      <TR>
747         <TD>
748            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
749               <TR>
750                  <TD>
751                     <P>virtual status_t
752                     <FONT SIZE="+1"><B><TT>Instantiate(</TT></B></FONT>BPositionIO
753                     *<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
754                     size_t <FONT FACE="HELVETICA" COLOR="#991122"><I>length</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
755                  </TD>
756               </TR>
757            </TABLE>
758            </P>
759         </TD>
760      </TR>
761   </TABLE>
762
763   <P>Initializes this message to the RFC 822 format data in
764   <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
765   starting at <FONT FACE="HELVETICA" COLOR="#991122"><I>data
766   </I></FONT>-&gt;Position(), for up to <FONT FACE="HELVETICA" COLOR="#991122"><I>length
767   </I></FONT>bytes.</P>
768
769   <P><B>Return Value:</B></P>
770
771   <BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
772
773      <P>- <B>B_BAD_TYPE</B> if <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT FACE="HELVETICA">
774      </FONT>does not seem to be an e-mail message.</P></BLOCKQUOTE></BLOCKQUOTE>
775
776<P>
777
778<HR>
779
780<A NAME=Render></A><TABLE>
781   <TR>
782      <TD>
783         <P></P>
784      </TD>
785      <TD>
786         <P><FONT SIZE="+2">Render () </FONT></P>
787      </TD>
788   </TR>
789</TABLE>
790</P>
791
792<P>&nbsp;</P>
793
794<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
795      <TR>
796         <TD>
797            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
798               <TR>
799                  <TD>
800                     <P>virtual status_t
801                     <FONT SIZE="+1"><B><TT>Render(</TT></B></FONT>BPositionIO
802                     *<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
803                  </TD>
804               </TR>
805            </TABLE>
806            </P>
807         </TD>
808      </TR>
809   </TABLE>
810
811   <P>Renders the message into RFC 822 format and places the result
812   in <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
813   starting at <FONT FACE="HELVETICA" COLOR="#991122"><I>data
814   </I></FONT>-&gt;Position(). If <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>
815   is a BFile, writes appropriate attributes and sets its MIME type to text/x-email.</P>
816
817   <P><B>Return Value:</B></P>
818
819   <BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.</BLOCKQUOTE>
820
821   <P></TABLE></P></BLOCKQUOTE>
822<P>
823
824<HR>
825
826<A NAME=RenderTo></A><TABLE>
827   <TR>
828      <TD>
829         <P></P>
830      </TD>
831      <TD>
832         <P><FONT SIZE="+2">RenderTo () </FONT></P>
833      </TD>
834   </TR>
835</TABLE>
836</P>
837
838<P>&nbsp;</P>
839
840<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
841      <TR>
842         <TD>
843            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
844               <TR>
845                  <TD>
846                     <P>status_t
847                     <FONT SIZE="+1"><B><TT>RenderTo(</TT></B></FONT>BDirectory
848                     *<FONT FACE="HELVETICA" COLOR="#991122"><I>dir</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
849                  </TD>
850               </TR>
851            </TABLE>
852            </P>
853         </TD>
854      </TR>
855   </TABLE>
856
857   <P>Creates a new file in <FONT FACE="HELVETICA" COLOR="#991122"><I>dir</I></FONT>, named according to
858   the following format: &quot;Subject&quot; &lt;To&gt; <I>unique indentifier</I>. Calls
859   <A HREF="#Render">Render()</A> on the resulting file and writes appropriate attributes.</P>
860
861   <P><B>Return Value:</B></P>
862
863   <BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.</BLOCKQUOTE>
864
865   <P></TABLE></P></BLOCKQUOTE>
866 <P>
867
868<HR>
869
870<A NAME=Send></A><TABLE>
871   <TR>
872      <TD>
873         <P></P>
874      </TD>
875      <TD>
876         <P><FONT SIZE="+2">Send () </FONT></P>
877      </TD>
878   </TR>
879</TABLE>
880</P>
881
882<P>&nbsp;</P>
883
884<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
885      <TR>
886         <TD>
887            <P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
888               <TR>
889                  <TD>
890                     <P>status_t
891                     <FONT SIZE="+1"><B><TT>Send(</TT></B></FONT>bool
892                     <FONT FACE="HELVETICA" COLOR="#991122"><I>send_now</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
893                  </TD>
894               </TR>
895            </TABLE>
896            </P>
897         </TD>
898      </TR>
899   </TABLE>
900
901   <P>Calls <A HREF="#RenderTo">RenderTo()</A> with the directory specified by the <A HREF="MailChain.html">MailChain</A>
902   passed to <A HREF="#SendViaAccount">SendViaAccount()</A>. If that is invalid, it uses the default outbound chain
903   given by <A HREF="MailSettings.html#DefaultOutboundChainID">MailSettings::DefaultOutboundChainID()</A>. After
904   rendering the message, if <FONT FACE="HELVETICA" COLOR="#991122"><I>send_now</I></FONT> is <B>true</B>,
905   calls <A HREF="MailDaemon.html#SendQueuedMail">MailDaemon::SendQueuedMail()</A>.</P>
906
907   <P><B>Return Value:</B></P>
908
909   <BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.<P>
910   - <B>B_MAIL_NO_DAEMON</B> if the mail daemon is not running.<P>
911   - something else if there is another error.</BLOCKQUOTE>
912
913   <P></TABLE></P></BLOCKQUOTE>
914<P><!--TOP LINKS-->
915
916<HR NOSHADE>
917
918</P>
919
920<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
921   <TR>
922      <TD>
923         <P><TABLE BGCOLOR="#550033" CELLPADDING=5>
924            <TR>
925               <TD>
926                  <P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
927                  Kit 2 Root</B></FONT></A></P>
928               </TD>
929               <TD>
930                  <P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
931                  Public API</B></FONT></A></P>
932               </TD>
933            </TR>
934         </TABLE>
935         </P>
936      </TD>
937   </TR>
938</TABLE>
939</CENTER>
940
941<P><!--TOP LINKS--> <!-- Footer for Release 5 HTML Be Book --><BR>
942</P>
943
944<CENTER><FONT SIZE="+3" COLOR="#555555"><I>Mail Daemon 2 API
945Documentation</I></FONT>
946
947<P><FONT SIZE="+1" COLOR="#555555"><I>&copy;2001 Dr. Zoidberg
948Enterprises</I></FONT></P></CENTER>
949</BODY>
950</HTML>
951